package com.aner.test.controller;
import com.aner.tester.controller.BaseControllerTest;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.aner.tester.utils.text.StringUtils;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;


/**
 * PutTestControllerTest class
 * 
 * @author aner
 * @date 2020-12-30
 */
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@RunWith(SpringRunner.class)
@AutoConfigureMockMvc
public class PutTestControllerTest extends BaseControllerTest
{

    @Test
    public void testTest() {
        String params = "{'booleanTest':false,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.9482067137533567,'floatTest':0.2860945,'intTest':0,'longTest':0,'stringTest':'猫安0广狗猪'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.put("/test/", jsonStr);
        
    }
    @Test
    public void testRequestParamDateTest() {
        String params = "{'testDate':'2020-12-30 13:39:02'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.put("/testRequestParamDate/", jsonStr);
        
    }
    @Test
    public void testRequestBodyDateTest() {
        String params = "1609306742230";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.putBody("/testRequestBodyDate/", jsonStr);
        
    }
    @Test
    public void testRequestBodyListTest() {
        String params = "['公安猪猪第','狗广东小的','0小23广','四1','广司东广']";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.putBody("/testRequestBodyList/", jsonStr);
        
    }
    @Test
    public void testRequestParamListTest() {
        String params = "{'testList':['事小小猪告','尔3532']}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.put("/testRequestParamList/", jsonStr);
        
    }
    @Test
    public void testRequestBodyMapTest() {
        String params = "{'的的小小事故':'763004','猫广':'58','东0':'35723','故司':'7154'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.putBody("/testRequestBodyMap/", jsonStr);
        
    }
    @Test
    public void testRequestBodyLongTest() {
        String params = "1";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.putBody("/testRequestBodyLong/", jsonStr);
        
    }
    @Test
    public void testPathVariableTest() {
        String params = "{'params':['个小','1猪','个小个','四狗猪狗'],'id':[0,1]}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.put("/testPathVariable/{params}/{id}", jsonStr);
        
    }
    @Test
    public void testDateTest() {
        String params = "{'test':'2020-12-30 13:39:02'}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.put("/testDate/", jsonStr);
        
    }
    @Test
    public void testBodyTest() {
        String params = "{'booleanTest':true,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.6104080737491464,'floatTest':0.8943124,'intTest':1,'longTest':1,'strArray':['小狗公的广四','猫告个猪小','的东告'],'stringList':['事告故猪安小','小小公小猫','0故','小143猪5','猪广猫尔狗0','三猫的猪广安'],'stringTest':'第三小猫事','testObjectArray':[{'booleanTest':false,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.04041719431044499,'floatTest':0.16874743,'intTest':0,'longTest':1,'stringTest':'三猫的'},{'booleanTest':true,'byteTest':0,'dateTest':'2020-12-30 13:39:02','doubleTest':0.9964636737933603,'floatTest':0.23040712,'intTest':0,'longTest':1,'stringTest':'狗四司告告'},{'booleanTest':true,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.42442134118101715,'floatTest':0.59731895,'intTest':0,'longTest':3,'stringTest':'故小狗'}],'testObjectList':[{'booleanTest':false,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.9205770684305915,'floatTest':0.22006917,'intTest':1,'longTest':3,'stringTest':'狗广0'},{'booleanTest':true,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.876930725379688,'floatTest':0.1610381,'intTest':1,'longTest':3,'stringTest':'公狗四事4小'},{'booleanTest':true,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.738194311954876,'floatTest':0.14730132,'intTest':1,'longTest':1,'stringTest':'小猫的小'},{'booleanTest':false,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.44225688902796445,'floatTest':0.5677114,'intTest':0,'longTest':3,'stringTest':'个小1事小告'},{'booleanTest':false,'byteTest':1,'dateTest':'2020-12-30 13:39:02','doubleTest':0.47381477823718776,'floatTest':0.099321485,'intTest':1,'longTest':2,'stringTest':'猫司1司'}],'testObjectMap':{'小个':'178431','三狗':'13924'}}";
        String jsonStr = StringUtils.replaceSingleQuoteWithDouble(params);
                    this.putBody("/testRequestBody/", jsonStr);
        
    }
}
